package filter;

import java.io.IOException;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
public class AbstractFilter {
 
    public AbstractFilter() {
        super();
    }
 
    protected void doLogin(ServletRequest request, ServletResponse response, HttpServletRequest req) throws ServletException, IOException {
    	HttpServletRequest rq = (HttpServletRequest) request;
    	HttpServletResponse rp = (HttpServletResponse) response;
    	RequestDispatcher rd = req.getRequestDispatcher(rq.getContextPath()  + "/public/Login.xhtml");
        rp.sendRedirect(rq.getContextPath()  + "/public/Login.xhtml");
    	//rd.forward(request, response);
    }
 
    protected void accessDenied(ServletRequest request, ServletResponse response, HttpServletRequest req) throws ServletException, IOException {
    	HttpServletRequest rq = (HttpServletRequest) request;
    	HttpServletResponse rp = (HttpServletResponse) response;
    	RequestDispatcher rd = req.getRequestDispatcher(rq.getContextPath()  + "/public/Login.xhtml");
        rp.sendRedirect(rq.getContextPath()  + "/pages/AcessoNegado.xhtml");
    	//rd.forward(request, response);
    }
}